/**
 * @author hfutrell
 */

function rb_err_to_string(errorcode){

	if (errorcode == gl.NO_ERROR) {
		return "gl.NO_ERROR";
	}
	if (errorcode == gl.INVALID_ENUM) {
		return "gl.INVALID_ENUM";
	}
	if (errorcode == gl.INVALID_VALUE) {
		return "gl.INVALID_VALUE";
	}
	if (errorcode == gl.INVALID_OPERATION) {
		return "gl.INVALID_OPERATION";
	}
	if (errorcode == gl.OUT_OF_MEMORY) {
		return "gl.OUT_OF_MEMORY";
	}
	else {
		return "unknown error";
	}

}

 function rb_check_error(s){
 
 	error = gl.getError();
	if ( error != gl.NO_ERROR ) {
		console.error( s + ": " + rb_err_to_string(error) );
	}
 
 }
